<!DOCTYPE html>
{% load static %}
<html lang="zh-Hans">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}机械臂实验系统{% endblock %}</title>
    <!-- 添加网站图标 -->
    <link rel="icon" type="image/svg+xml" href="{% static 'img/favicon.svg' %}">
    <link href="{% static 'css/vendor/bootstrap.min.css' %}" rel="stylesheet">
    <link rel="stylesheet" href="{% static 'css/vendor/bootstrap-icons.css' %}">
    {% block extra_css %}{% endblock %}
    <style>
        body {
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }
        
        main {
            flex: 1;
        }
        
        .navbar {
            background-color: #343a40;
        }
        
        .navbar-brand {
            font-weight: bold;
            color: #ffffff;
        }
        
        .navbar-nav .nav-link {
            color: rgba(255, 255, 255, 0.8);
        }
        
        .navbar-nav .nav-link:hover {
            color: #ffffff;
        }
        
        footer {
            background-color: #343a40;
            color: #ffffff;
            padding: 1rem 0;
        }
        
        .btn-primary {
            background-color: #007bff;
            border-color: #007bff;
        }
        
        .btn-primary:hover {
            background-color: #0069d9;
            border-color: #0062cc;
        }
    </style>
</head>
<body>
    {% if user.is_authenticated %}
    <nav class="navbar navbar-expand-lg navbar-dark sticky-top">
        <div class="container">
            <a class="navbar-brand" href="{% url 'home' %}">
                <i class="bi bi-robot"></i> 机械臂实验系统
            </a>
            <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse justify-content-between" id="navbarNav">
                <ul class="navbar-nav">
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'home' %}">主页</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'knowledge_graph' %}">实验教学</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'structure' %}">3D构造</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'experiment_guide' %}">实验指南</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'experiment_platform' %}">实验平台</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{% url 'experiment_history' %}">实验记录</a>
                    </li>
                </ul>
                <ul class="navbar-nav">
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown">
                            <i class="bi bi-person-circle"></i> {{ user.username }}
                        </a>
                        <ul class="dropdown-menu dropdown-menu-end">
                            <li><a class="dropdown-item" href="{% url 'profile' %}">个人信息</a></li>
                            <li><hr class="dropdown-divider"></li>
                            <li><a class="dropdown-item" href="{% url 'logout' %}">退出登录</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>
    {% endif %}

    <main class="py-4">
        <div class="container">
            {% if messages %}
                {% for message in messages %}
                    <div class="alert alert-{{ message.tags }} alert-dismissible fade show">
                        {{ message }}
                        <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
                    </div>
                {% endfor %}
            {% endif %}
            
            {% block content %}{% endblock %}
        </div>
    </main>

    <footer class="text-center">
        <div class="container">
            <p>&copy; 2025 机械臂实验系统 | 版权所有</p>
        </div>
    </footer>

    <script src="{% static 'js/vendor/bootstrap.bundle.min.js' %}"></script>
    {% block extra_js %}{% endblock %}
</body>
</html> 